﻿@using LessBoard.Models
@model SeveritiesModel
@{
    ViewBag.Title = "Severities";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var grid = new WebGrid(Model.LogEntriesBySeveritySummary);
}

<section id="main" class="column">
    <!-- Summary article -->
    <article class="module width_full">
        <h2>
            Log Entries by Severity</h2>
            @grid.GetHtml(tableStyle: "tablesorter",
                                  columns: new[] {grid.Column("Severity", 
                                        format: p => Html.ActionLink(
                                        ((object)p.Severity).ToString(),
                                        "EntriesOfSeverity",
                                        new { severityOfEntries =p.Severity },
                                        new { @class = "detailsLink" })), 
                                grid.Column("Count"), 
                                grid.Column("LastMessage",header:"Last Message at") })
    </article>
    <!-- Summary article -->
    <article class="module width_full">
        
        <div id="entriesOfSeverityContainer">
        </div>
    </article>
    <script type="text/javascript">
        $(function () {
            $('.detailsLink').click(function () {
                $('#entriesOfSeverityContainer').load(this.href);
                return false;
            });
        });
</script>
</section>
